<?php
session_cache_expire(999999999);
if (!isset($_SESSION)) {
    session_start();
}


include '../operations/connection.php';

$listreference = $_SESSION['listreference6'];
$namereference = $_SESSION['namereference6'];
$i = $_SESSION['slreference6'];

mysql_query("DELETE FROM `list_sendmailproject` WHERE `id_project`='".$_REQUEST['id_project']."' AND `id_main_employee`='".$_SESSION['IDEmployee']."'");
echo "DELETE FROM `list_sendmailproject` WHERE `id_project`='".$_REQUEST['id_project']."' AND `id_main_employee`='".$_SESSION['IDEmployee']."'";
for ($j = 0; $j < $i; $j++) {
    //mysql_query("INSERT INTO `list_sendmailmoney` (`employee_id`) VALUES ('" . $listreference[$j] . "')");
    mysql_query("INSERT INTO `list_sendmailproject` (`id_project`, `id_main_employee`, `id_employee`) VALUES ('".$_REQUEST['id_project']."', '".$_SESSION['IDEmployee']."', '".$listreference[$j]."')");
}

mysql_close($connection);
?>